﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace FwProject.Migrations
{
    public partial class Update_To_ConfigInfo_fwyg : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "CorporateName",
                table: "ConfigInfo",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Abbreviation",
                table: "ConfigInfo",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "AgentPerson",
                table: "ConfigInfo",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "CorporateAddress",
                table: "ConfigInfo",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "CorporateMobile",
                table: "ConfigInfo",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "PaymentCode",
                table: "ConfigInfo",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "RegisterDate",
                table: "ConfigInfo",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<long>(
                name: "RegisterUserId",
                table: "ConfigInfo",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.CreateIndex(
                name: "IX_ConfigInfo_RegisterUserId",
                table: "ConfigInfo",
                column: "RegisterUserId");

            migrationBuilder.AddForeignKey(
                name: "FK_ConfigInfo_AbpUsers_RegisterUserId",
                table: "ConfigInfo",
                column: "RegisterUserId",
                principalTable: "AbpUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ConfigInfo_AbpUsers_RegisterUserId",
                table: "ConfigInfo");

            migrationBuilder.DropIndex(
                name: "IX_ConfigInfo_RegisterUserId",
                table: "ConfigInfo");

            migrationBuilder.DropColumn(
                name: "Abbreviation",
                table: "ConfigInfo");

            migrationBuilder.DropColumn(
                name: "AgentPerson",
                table: "ConfigInfo");

            migrationBuilder.DropColumn(
                name: "CorporateAddress",
                table: "ConfigInfo");

            migrationBuilder.DropColumn(
                name: "CorporateMobile",
                table: "ConfigInfo");

            migrationBuilder.DropColumn(
                name: "PaymentCode",
                table: "ConfigInfo");

            migrationBuilder.DropColumn(
                name: "RegisterDate",
                table: "ConfigInfo");

            migrationBuilder.DropColumn(
                name: "RegisterUserId",
                table: "ConfigInfo");

            migrationBuilder.AlterColumn<string>(
                name: "CorporateName",
                table: "ConfigInfo",
                nullable: true,
                oldClrType: typeof(string));
        }
    }
}
